// 完全二叉树
let format = 'yyyy/MM/dd'
let time = new Date()
let year = time.getFullYear(), month = time.getMonth(), date = time.getDate()
format = format.replace('yyyy',year)
format = format.replace('MM', month)
format = format.replace('dd', date)
console.log(format);

// [1,2,[1,2,[1,2,3]],1,[1]]求和
function sum(nums) {
    let res = 0 
    function add(arr) {
        arr.forEach(item => {
            if(item instanceof arr) {
                add(arr)
            }
            else {
                res += item
            }
        })
    }
    return res
}